<%--                                                                       --%>
<%-- Copyright (c) 2004-2005 BroadVision, Inc.  All rights reserved.       --%>
<%--                                                                       --%>
<%-- This software is copyrighted. Under the copyright laws, this software --%>
<%-- may not be copied, in whole or in part, without prior written consent --%>
<%-- of BroadVision, Inc. or its assignees. This software is provided      --%>
<%-- under the terms of a license between BroadVision and the recipient,   --%>
<%-- and its use is subject to the terms of that license.                  --%>
<%--                                                                       --%>
<%-- This software may be protected by one or more U.S. and International  --%>
<%-- patents.  Certain applications of BroadVision One-To-One software are --%>
<%-- covered by U.S. patent 5,710,887.                                     --%>
<%--                                                                       --%>
<%-- TRADEMARKS: BroadVision and BroadVision One-To-One are registered     --%>
<%-- trademarks of BroadVision, Inc., in the United States and the         --%>
<%-- European Community, and are trademarks of BroadVision, Inc., in other --%>
<%-- countries.  The BroadVision logo, is a trademark of BroadVision,      --%>
<%-- Inc., in the United States and other countries. Additionally, IONA    --%>
<%-- and Orbix are trademarks of IONA Technologies, Ltd.  RSA, MD5, and    --%>
<%-- RC2 are trademarks of RSA Data Security, Inc.                         --%>
<%--                                                                       --%>

<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el" %>
<%@ taglib uri="/WEB-INF/struts-bean-el.tld" prefix="bean-el" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>

<script language="JavaScript">

function doFindQualifierAction(){
  doPickerPopupAction('<c:url value="/mt/categorySearchPickerPopup.do"/>', 'selectedQualifier', '315', null, '', null, false, true, null, null, null);
	}
	
function selectedQualifier(selectedIds, selectedNames) {
	if (selectedIds.length >= 1 && selectedNames.length >= 1) {
      document.epUserUserTemplateWithQualifierReportForm.id.value = selectedIds[0];
      var name = selectedNames[0];     
      if(name.charAt(0) == '/') name = name.substring(1);  
      document.epUserUserTemplateWithQualifierReportForm.name.value = name;
    }
	document.epUserUserTemplateWithQualifierReportForm.action='<c:url value="/ep/userUserTemplateWithQualifierReport.do" />';
	document.epUserUserTemplateWithQualifierReportForm.submit();
  }	
  
function getTimeStamp() {
    var now = new Date;
    var timestamp = '' + now.getYear() + now.getMonth() + now.getDate() + 
      now.getHours() + now.getMinutes() + now.getSeconds() + now.getMilliseconds();
    return timestamp;
  }	
	
  
function doReportListAction(theForm) {

  var id = theForm.id.value;
  if(id == 0){
	alert('<bean-el:message key="ep.report.qualifier.find.alert" bundle="ep.messages"/>');
	return false;
  }
  
  if(theForm.scope.value == 0){
  	var selectUrl = '<c:url value="/ep/userWithQualifierReportList.do" />';
  }
  else{
  	var selectUrl = '<c:url value="/ep/userTemplateWithQualifierReportList.do" />';
  }
  if (selectUrl != null) {
      if (selectUrl.indexOf("?") < 0) {
        selectUrl += "?";
      } 
      else {
        selectUrl += "&";
      }
    }
  selectUrl +=  '&selectedQualifierValueId=' + theForm.selectedQualifierValueId.value + 
  				'&qualifierName=' + theForm.name.value;
  var popup = window.open(selectUrl, 'report'+getTimeStamp(), 'width=1000,height=600,resizable=yes,scrollbars=yes,status=0');
  self.name = 'window' + '<%= request.getSession().getId()%>'
  if (popup != null) {
    if (popup.opener == null) {
      popup.opener = self;
    }
  }
  return false;
}
</script>

<%@include file="/mt/common/pickerPopupHelper.jsp" %>
<% String ctxPath = request.getContextPath(); %>

<html-el:form action="/ep/userWithQualifierReportList.do" onsubmit="return doReportListAction(this);">
<html-el:hidden property="id"/>
<table class="zoneFive" width="100%" border="0" cellspacing="0" cellpadding="0" summary="content area">
  <tr>
    <td valign="top" width="100%">
      <div class="pageTitle">
      	<bean-el:message key="ep.report.title" bundle="ep.messages"/>: <bean-el:message key="ep.report.list.user.userTemplate.qualifier" bundle="ep.messages"/>
      </div>
      <div class="errorMessage"><html-el:errors bundle="ep.messages"/></div>
      <div class="pageSubtitle">
        <span class="left"><bean-el:message key="ep.report.search.criteria" bundle="ep.messages"/></span>
      </div>
	  
    <table class="labelForm" width="100%" border="0" cellspacing="0" cellpadding="0" summary="report">
			<tr>
        <td class="label" width="20%">
          <bean-el:message key="ep.report.label.selectQualifier" bundle="ep.messages"/>:
        </td>
        <td class="labelField" width="80%">
          <html-el:text size="25" maxlength="50" property="name" readonly="true"/>&nbsp;
          <input type="button" name="actionFind" class="pageButton"
					onclick="doFindQualifierAction()"
					value='<bean-el:message key="button.browse" bundle="ep.messages"/>'/>
        </td>
      </tr>		
      <tr>
        <td class="label" width="20%">
				  <bean-el:message key="ep.report.label.qualifierValue" bundle="ep.messages"/>:
				</td>
        
			  <td class="labelField" width="80%">
			  	<html-el:select property="selectedQualifierValueId" size="1">
            <c:choose>				  
              <c:when test="${not empty epUserUserTemplateWithQualifierReportForm.map.qualifierValues}">
                <html-el:optionsCollection property="qualifierValues" value="id" label="name"/>
              </c:when>
              <c:otherwise>
                <html-el:option key="ep.report.qualifier.label.no.value" value="0" bundle="ep.messages"/>
              </c:otherwise>
            </c:choose>
          </html-el:select>
        </td>
      </tr>
      <tr>
        <td class="label" width="20%">
		  		<bean-el:message key="ep.report.label.scope" bundle="ep.messages"/>:
        </td>                                             
		    <td class="labelField" width="80%">
         	<html-el:select property="scope" size="1">
			    	<html-el:option key="ep.report.label.scope.user" value="0" bundle="ep.messages"/>
						<html-el:option key="ep.report.label.scope.userTemplate" value="1" bundle="ep.messages"/>
					</html-el:select>
				</td>
			</tr>
			
    </table>
	  <div class="pageButtonWrap" align="right">
      <input hspace="40" type="submit" name="actionSearch" class="pageButton" value='<bean:message key="button.showResults" bundle="ep.messages"/>'>
    </div>
		</td>
	</tr>
</table>
</html-el:form>
